/**
 * projectName: mbzwb-parent
 * fileName: AssessController.java
 * packageName: com.palmdoctor.mb.server.assess.controller
 * date: 2021-08-09 14:38
 * copyright(c) 2021 http://www.hydee.cn/ Inc. All rights reserved.
 */
package com.zny.sescore.controller;

import com.zny.sescore.model.ApiResult;
import com.zny.sescore.model.AssessModel;
import com.zny.sescore.model.AssessModelResult;
import com.zny.sescore.model.AssessRecord;
import com.zny.sescore.model.vo.AssessRecordVO;
import com.zny.sescore.service.AssessModelService;
import com.zny.sescore.service.AssessRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @version: V1.0
 * @author: zhangnayi
 * @className: AssessController
 * @packageName: com.palmdoctor.mb.server.assess.controller
 * @description: 评估控制器
 * @data: 2021-08-09 14:38
 **/
@Api(tags = "评估表单接口")
@Slf4j
@RestController
@RequestMapping("/assess/result")
public class AssessResultController extends CurdController<AssessModelService, AssessModel> {

    @Autowired
    private AssessRecordService assessRecordService;

    @ApiOperation("提交表单")
    @PostMapping("/submit")
    public ApiResult<AssessModelResult> submit(@RequestBody AssessRecordVO submitAssessVO) {
        return ApiResult.success(assessRecordService.submitPatientAssessResult(submitAssessVO));
    }

    @ApiOperation("查看评估结果")
    @GetMapping("/detail")
    public ApiResult<List<AssessRecord>> getResultDetail(@RequestParam int modelId, @RequestParam int diseaseId, @RequestParam int patientId) {
        return ApiResult.success(assessRecordService.getPatientResultDetail(modelId, diseaseId, patientId));
    }
}